#include "FreeRTOS_TEST.h"


#include "FreeRTOS.h"
#include "task.h"

#include "gpio.h"

#define START_TASK_STACK 128
#define START_TASK_PRIORITY 1
TaskHandle_t start_task_handle;
void start_task(void * pvParameters);

#define TASK1_STACK 128
#define TASK1_PRIORITY 1
TaskHandle_t task1_handle;
void task1(void * pvParameters);

void freertos_start(void)
{
	xTaskCreate( (TaskFunction_t) start_task,
								(char * ) "start_task",
											(configSTACK_DEPTH_TYPE) START_TASK_STACK,
											(void * ) NULL,
											(UBaseType_t) START_TASK_PRIORITY,
											(TaskHandle_t * ) &start_task_handle);
											
											vTaskStartScheduler();
										}										
												
	
void start_task(void *pvParameters)
{
	
	xTaskCreate( (TaskFunction_t) task1,
								(char * ) "task1",
											(configSTACK_DEPTH_TYPE) TASK1_STACK,
											(void * ) NULL,
											(UBaseType_t) TASK1_PRIORITY,
											(TaskHandle_t * ) &task1_handle);
											
											vTaskDelete(NULL);
											
										}

void task1(void *pvParameters)
{
	while(1)
	{
		HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
		vTaskDelay(500);
	}
}
